var map=null;
$(document).ready(function () {
    map = new AnimationMap("map_container"); //创建地图
})

function AnimationMap(domId) {
    this.map = new BMap.Map(domId); // 创建地图实例
    this.init();
}

AnimationMap.prototype.init = function () {
    this.map.centerAndZoom("成都", 10);
    this.map.enableScrollWheelZoom();
    this.map.enableKeyboard();
    setTimeout(()=>{
        map.addMarker();
    },1000)
   
};
 // 随机向地图添加25个标注
AnimationMap.prototype.addMarker = function () {
      var bounds = this.map.getBounds();
      var sw = bounds.getSouthWest();
      var ne = bounds.getNorthEast();
      var lngSpan = Math.abs(sw.lng - ne.lng);
      var latSpan = Math.abs(ne.lat - sw.lat);
      for (var i = 0; i < 25; i ++) {
          var point = new BMap.Point(sw.lng + lngSpan * (Math.random() * 0.7), ne.lat - latSpan * (Math.random() * 0.7));
          var myIcon=new BMap.Icon("img/icon_1.png", new BMap.Size(25,25));
          var marker = new BMap.Marker(point,{icon:myIcon});
          this.map.addOverlay(marker);
      }
      setTimeout(()=>{
        map.AnimationPoint();
      },500)
};

//添加闪烁点
AnimationMap.prototype.AnimationPoint = function () {
    $('.BMap_Marker div').append('<span class="effectPoint"></span>');
    $('.effectPoint:even').addClass('effectPoint1');
    $('.effectPoint:odd').addClass('effectPoint2');
 }
